package com.example.demofdfs.util.shell;

/**
 * 对象池包装器
 * @author Administrator
 *
 * @param <T>
 */
public class ObjectPool<T> {

	private static int poolCount = 0;
	
	/**
	 * 连接对象
	 */
	T object;
	
	/**
	 * 是否在使用, false 未使用, true 已经使用
	 */
	boolean use = false;  
	
	/**
	 * 连接的id
	 */
	private String id;
	
	/**
	 * 使用次数
	 */
	private int count;
	
	public ObjectPool(T object) {
		this.object = object;
	}

	public ObjectPool(T object, String id) {
		this.object = object;
		this.id = id;
	}

	public T getObject() {
		return object;
	}

	public boolean isUse() {
		return use;
	}

	public void setUse(boolean use) {
		this.use = use;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}
	
	static int poolCount() {
		synchronized (ObjectPool.class) {
			return ++poolCount;
		}
	}
	
}
